package com.yonyou.utils;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.yonyou.biz.vo.MyPluginState;

@State(
    name = "yonbipState",
    storages = @Storage("YonbipPlugin.xml")
)
public class MyPluginStateComponent implements PersistentStateComponent<MyPluginState> {
    public static MyPluginStateComponent getInstance() {
        return ServiceManager.getService(MyPluginStateComponent.class);
    }

    private MyPluginState myState = new MyPluginState();

    @Override
    public MyPluginState getState() {
        return myState;
    }

    @Override
    public void loadState(MyPluginState state) {
        XmlSerializerUtil.copyBean(state, myState);
    }

    // 这里可以添加其他方法和字段来管理插件状态
}


